<div class="testpaper-question testpaper-question-choice  js-testpaper-question {% if setting('magic.testpaper_watermark') %}js-testpaper-watermark{% endif %}" data-watermark-url="{{ path('cloud_testpaper_watermark') }}" id="question{{ question.id }}">
	{% set keys = [] %}
	{% set keys_answer = [] %}
	<div class="testpaper-question-body">
    {% include 'question/part/question-stem.html.twig' %}

		<ul class="testpaper-question-choices js-testpaper-question-list">
			{% for key, choice in question.metas.choices|default() %}
			  {% set itemClass =  ((paperResult.status|default(null) in ['reviewing', 'finished']) and (key in question.answer)) ? 'testpaper-question-choice-item--right' : '' %}
			  {% set choiceIndex = (65+key)|chr %}

				<li class="{{ itemClass }} testpaper-question-body-item testpaper-question-choice-item"><span class="testpaper-question-body-item__index">{{ choiceIndex }}.</span> {{ choice|bbCode2Html|raw }}</li>
				{% if key in question.answer %}
					{% set keys = keys|merge([choiceIndex]) %}
				{% endif  %}
				{% if key in question.testResult.answer|default([]) %}
					{% set keys_answer = keys_answer|merge([choiceIndex]) %}
				{% endif %}
			{% endfor %}
		</ul>
	</div>
	{% if not question.isDeleted|default(0) and (paperResult.status|default(null) in ['reviewing', 'finished'] and setting('questions.testpaper_answers_show_mode','submitted') == 'submitted')
	or (setting('questions.testpaper_answers_show_mode','submitted') == 'reviewed'  and paperResult.status|default(null) == 'finished')
	or (setting('questions.testpaper_answers_show_mode','submitted') == 'hide'  and paperResult.status|default(null) in ['reviewing', 'finished'] and paperResult.type not in ['testpaper']) %}
		<div class="testpaper-question-footer clearfix">
		  <div class="testpaper-question-result">
		  	{{'course.question_manage.question.true_answer'|trans}} <strong class="color-success">{{ keys|join(',') }}</strong>，
				{% if question.testResult.status|default('noAnswer') == 'right' %}
					{{'course.question_manage.question.answer_right'|trans}}
				{% elseif question.testResult.status|default('noAnswer') == 'partRight' %}
          {{ 'course.question_manage.question.answer_part_right'|trans({'%keyAnswer%':keys_answer|join(',')})|raw }}
					{% if showScore|default(1) %}
						{{'course.question_manage.question.score'|trans({'%testResult.score%': question.testResult.score})}}
					{% endif %}
				{% elseif question.testResult.status|default('noAnswer') == 'wrong' %}
				{{'course.question_manage.question.your_answer'|trans}} <strong class="color-danger">{{ keys_answer|join(',') }}</strong>。{{'course.question_manage.question.answer_wrong'|trans}}
				{% elseif question.testResult.status|default('noAnswer') == 'noAnswer' %}
				  {{'course.question_manage.question.answer_empty'|trans}}
				{% endif %}
		  </div>

			<div class="testpaper-question-actions pull-right mts">
				{% include 'question/part/flag.html.twig' with { flags:['favorite', 'analysis'] } %}
			</div>
		</div>
		{% include 'question/part/show-analysis.html.twig' with {showAnalysis:1} %}

	{% elseif not question.isDeleted|default(0) %}
		<div class="testpaper-question-footer clearfix">

		  <div class="testpaper-question-footer__input pull-left js-testpaper-question-label">
				{% for key, choice in question.metas.choices|default() %}
					{% set choiceIndex = (65+key)|chr %}

					<label class="{% if question.type == 'single_choice' %}radio{% else %}checkbox{% endif %}-inline {% if choiceIndex in keys_answer %}active{% endif %}">
						<input type="{% if question.type == 'single_choice' %}radio{% else %}checkbox{% endif %}" data-type="{{ question.type }}" name="{{ question.id }}" value="{{ key }}" {% if choiceIndex in keys_answer %}checked{% endif %} >
						{{ choiceIndex }}
					</label>
				{% endfor %}
		  </div>

		  <div class="testpaper-question-actions pull-right mts">
				{% include 'question/part/flag.html.twig' with { flags:['mark', 'favorite'],resultStatus:paperResult.status|default(null) } %}
		  </div>
		</div>

		{% if showAnswer|default(0) %}
			<div class="testpaper-preview-answer clearfix mtl mbl">
				<div class="testpaper-question-result">
				{{'course.question_manage.question.true_answer'|trans}} <strong class="color-success">{{ keys|join(',') }}</strong>
				</div>
			</div>
		{% endif %}
	{% endif %}

	{% include 'question/part/show-analysis.html.twig' with {showAnalysis:showAnalysis|default(0)} %}
</div>
